package com.cxhc.app.api;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.cxhc.app.api.mapper.RpConAdjustMapStructMapper;
import com.cxhc.app.api.mapper.SysEnterpriseMapStructMapper;
import com.cxhc.app.api.vo.RpConAdjustVo;
import com.cxhc.system.domain.app.RpConAdjust;
import com.cxhc.system.domain.app.SysEnterprise;
import com.cxhc.system.service.app.IRpConAdjustService;
import com.github.pagehelper.PageHelper;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.cxhc.common.annotation.Log;
import com.cxhc.common.core.controller.BaseController;
import com.cxhc.common.core.domain.AjaxResult;
import com.cxhc.common.enums.BusinessType;
import com.cxhc.common.utils.poi.ExcelUtil;
import com.cxhc.common.core.page.TableDataInfo;

/**
 * 矛盾调节Controller
 * 
 * @author Dhq
 * @date 2024-08-15
 */
@RestController
@RequestMapping("/api/RpConAdjust")
public class ApiRpConAdjust extends BaseController
{
    @Autowired
    private IRpConAdjustService rpConAdjustService;

    /**
     * 查询矛盾调节列表
     */
    @PostMapping("/list")
    public TableDataInfo list(@RequestBody RpConAdjustVo rpConAdjustVo)
    {
        RpConAdjust rpConAdjust = RpConAdjustMapStructMapper.INSTANCE.RpConAdjustVoToRpConAdjust(rpConAdjustVo);
        PageHelper.startPage(rpConAdjustVo.getPageNum(),rpConAdjustVo.getPageSize(),"AddTime desc");
        List<RpConAdjust> list = rpConAdjustService.selectRpConAdjustList(rpConAdjust);
        return getDataTable(list);
    }

    /**
     * 获取矛盾调节详细信息
     */
    @GetMapping(value = "/details/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long ID)
    {
        return success(rpConAdjustService.selectRpConAdjustByID(ID));
    }

    /**
     * 新增矛盾调节
     */
    @PostMapping("/insert")
    public AjaxResult add(@RequestBody RpConAdjustVo rpConAdjustVo)
    {
        RpConAdjust rpConAdjust = RpConAdjustMapStructMapper.INSTANCE.RpConAdjustVoToRpConAdjust(rpConAdjustVo);

        return toAjax(rpConAdjustService.insertRpConAdjust(rpConAdjust));
    }

    /**
     * 修改矛盾调节
     */
    @PostMapping("/update")
    public AjaxResult edit(@RequestBody RpConAdjustVo rpConAdjustVo)
    {
        RpConAdjust rpConAdjust = RpConAdjustMapStructMapper.INSTANCE.RpConAdjustVoToRpConAdjust(rpConAdjustVo);
        return toAjax(rpConAdjustService.updateRpConAdjust(rpConAdjust));
    }

    /**
     * 删除矛盾调节
     */
	@GetMapping("/delete/{id}")
    public AjaxResult remove(@PathVariable Long id)
    {
        return toAjax(rpConAdjustService.deleteRpConAdjustByID(id));
    }

    /**
     * 修改矛盾调节
     */
    @PostMapping("/over")
    public AjaxResult over(@RequestBody RpConAdjustVo rpConAdjustVo)
    {
        RpConAdjust rpConAdjust = RpConAdjustMapStructMapper.INSTANCE.RpConAdjustVoToRpConAdjust(rpConAdjustVo);
        return toAjax(rpConAdjustService.overRpConAdjust(rpConAdjust));
    }



}
